package com.lenovo.lcdm.common.enums;

/**
 * common response enum
 * @author
 */
public enum ResponseMsgEnum {
    SUCCESS(0, "Success"),
    FAIL(-1, "Fail"),
    UNKNOWN(-2, "System Error"),
    PARAMETER_ERROR(-3, "参数校验失败"),
    EXCEL_ERROR(-4, "excel数据异常"),
    DATE_PARAMETER_ERROR(-5,"输入日期不能小于今天"),
    LS_PRE_CHECK_ERROR(-6, "LS parameter pre-verification failed, please check the email"),
    LS_PRE_TYPE_ERROR(-7, "Template type mismatch"),
    LS_FILE_UPLOAD(-8, "Do not import this file repeatedly during import"),
    FILE_DOWNLOAD_ERROR(-9,"File download failed"),

    AUTH_ERROR(502, "Auth Error"),
    SERVER_BUSY(503, "服务器正忙，请稍后再试!"),
    DATABASE_OPERATION_FAILED(504, "数据库操作失败"),

    TOKEN_INVALID(1000, "Invalid Token, Please Check!"),
    USER_NOT_LOGIN(1001, "User Not Login"),
    USER_NOT_EXIST(1002, "User Not Exist, %s"),
    USER_NOT_AUTH(1003, "User Not Permission"),

    CONCURRENT_CONFLICT(2002, "Database concurrent conflict"),

    FREEMARKER_WRITE_FAILED(3001, "Write to freemarker template failed"),


    TOO_CONTAINS_ALL_PARAMETERS_INPUT(4007, "Too Many Contains All Parameter, limit: 50"),
    TOO_CONTAINS_ANY_PARAMETERS_INPUT(4008, "Too Many Contains Any Parameter, limit: 10"),

    EMAIL_ASYNC_ALERT(5001, "The data volume is too large, and you will be notified by email later"),
    CHECK_OUT_ALERT(5002, "The data has been checked out by other users")
    ;
    private int code;
    private String message;
    ResponseMsgEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return this.code;
    }

    public String getMessage() {
        return this.message;
    }

    public String formatMsg(Object... args) {
        return String.format(getMessage(), args);
    }
}
